<?php

class Core_Component_Menu_Model_Category extends Soul_Model_Entity_Base {

    protected $tableName = '{t}menu_category';

    public function getComponent() {
        if (!$this->issetData('component')) {
            if ($this->issetData('component_id')) {
                $this->data['component'] = App::loadModel('system/component', $this->getComponentId());
            }
        }
        return $this->data['component'];
    }

    protected function initializeProperties() {
        $this->createProperty('id', 'integer', TRUE, TRUE);
        $this->createProperty('component_id', 'integer')
                ->setInputType('select')
                ->setRequired(TRUE);
        $this->createProperty('code', 'string')
                ->setInputType('textbox')
                ->setRequired(TRUE)
                ->addRule(new Soul_Validation_Rule_Character());
        $this->createProperty('name', 'string')
                ->setInputType('textbox')
                ->setRequired(TRUE);
    }

}